﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using CochinitaCorte;

namespace CochinitaCorte//.CochinitaCorteData
{
    public class DataLayer
    {
        private const char Delimiter = '~';
        private DatabaseManager DBManager;

       
        #region publicSelection
            public string[] ReadSalesFiles(string FilePath)
            {
                return FileManager.ReadFile(Path.GetDirectoryName(FilePath) + "/" + Path.GetFileName(FilePath));
            }
            public bool WriteSalesFiles(string FullFilePath, string Content)
            {
                return FileManager.WriteToFile(FullFilePath, Content);
            }
            public string[] ReadUsuarios()
            {
                return DBManager.ReadFromDB("SELECT ID, Nombre, Usuario, Contrasena, Permisos FROM Usuarios");
            }
            public string[] ReadDatosFiscales()
            {
                return DBManager.ReadFromDB("SELECT CodigoRest, Nombre, NombreFiscal, RFC, Direccion, Telefono, Ciudad, pagaIVA, InicioOperaciones FROM Franquicias");
            }
            public string[] ReadMetas() 
            {
                return DBManager.ReadFromDB("SELECT CodigoRest, Lunes, Martes, Miercoles,Jueves, Viernes,Sabado, Domingo  FROM Limites");
            }
            public string[] ReadArticulos() 
            {
                return DBManager.ReadFromDB("Select CODIGO, SHORTDESC, LONGDESC FROM Productos");
            }
            public string ReadSettings() 
            {
                return DBManager.ReadFromDB("Select IVA, Impresora, FTPSettings, PaginaWeb, GuardarZ, FolderCortes From Settings")[0];
            }
        #endregion

        public bool SetData(List<string> SQL)
        {
            return DBManager.UpdateToDB(SQL);
        }

        public DataLayer()
        {
            DBManager = new DatabaseManager();
        }

   
   }
}
 
 